import { handleActions } from 'redux-actions'
import {
  INIT_MAIN_PAGE_B_TYPE,
  UPDATE_MAIN_PAGE_B_TYPE,
  GET_COMPOANY_INFO_TYPE
} from './type'

const Schema = {
  showEmpty: false,
  networkerror: false,
  haveCompanyApply: {},
  top: {},
  post: {},
  company: {},
  member: {},
  myCenterNumbers: {},
  companyLiveList: {},
  data: {}
}

export default handleActions(
  {
    [INIT_MAIN_PAGE_B_TYPE](state, action) {
      return {
        ...Schema
      }
    },
    [UPDATE_MAIN_PAGE_B_TYPE](state, action) {
      return {
        ...state,
        ...action.payload
      }
    },
    [GET_COMPOANY_INFO_TYPE](state, action) {
      console.log(action, 'actionactionactionactionaction')
      return {
        ...state,
        data: action.payload
      }
    }
  },
  Schema
)
